﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InterfaceFiles
{
  public class EPASWMM5InterfaceRecord : BaseInterfaceRecord, IInterfaceRecord
  {
    public EPASWMM5InterfaceRecord(IInterfaceReader reader,
      IInterfaceWriter writer, List<string> nodes)
      : base(reader, writer, nodes)
    {
    }

    public void Write(IInterfaceRecord record)
    {
      int i = 0;
      foreach (string node in nodes)
      {
        string writeString = 
          string.Format("{0} {1} {2} {3} {4} {5} {6} {7:F5}",
            node,
            record.RecordDateTime.Year,
            record.RecordDateTime.Month,
            record.RecordDateTime.Day,
            record.RecordDateTime.Hour,
            record.RecordDateTime.Minute,
            record.RecordDateTime.Second,
            record.Data[node]);
        writer.WriteString(writeString);
        writer.FlushRecord();
        i++;
      }
      Console.WriteLine("EPASWMM5InterfaceRecord.Write: {0} nodes written at {1}", i, record.RecordDateTime);
    }
  }
}
